package org.jint.adsltest.analysis;

public class PageTestSuite {
	public final int id;
	public final String place;
	public final String roundNo;
	public int case_count = 0;
	public int level_0_5 = 0;
	public int level_5_10 = 0;
	public int level_10_20 = 0;
	public int level_20_30 = 0;
	public int level_30_60 = 0;
	public int level_60_120 = 0;
	public int level_120_more = 0;
	public int not_access = 0;
	public int not_test = 0;
	public int data_error = 0;

	public PageTestSuite(int id, String place, String roundNo, int caseCount) {
		this.id = id;
		this.place = place;
		this.roundNo = roundNo;
		this.case_count = caseCount;
		this.not_test = case_count;
	}

	public void level(float loadtime) {
		not_test--;

		if (-1.1f < loadtime && loadtime < -0.9f) { // 实际上是 -1 ，代表被测网站出错
			not_access++;
		} else if (0f < loadtime && loadtime < 5f) {
			level_0_5++;
		} else if (5f <= loadtime && loadtime < 10f) {
			level_5_10++;
		} else if (10f <= loadtime && loadtime < 20f) {
			level_10_20++;
		} else if (20f <= loadtime && loadtime < 30f) {
			level_20_30++;
		} else if (30f <= loadtime && loadtime < 60f) {
			level_30_60++;
		} else if (60f <= loadtime && loadtime < 1200f) {
			level_60_120++;
		} else if (120f <= loadtime) {
			level_120_more++;
		} else {
			//strUtil.printInfo("Error value: " + loadtime);
			data_error++;
		}
	}

	public String toString() {
		return " " + level_0_5 + " " + level_5_10 + " " + level_10_20 + " "
				+ level_20_30 + " " + level_30_60 + " " + level_60_120 + " "
				+ level_120_more + " Error:" + data_error + " no access:"
				+ not_access + " no test:" + not_test;
	}
}
